<?php
$this->breadcrumbs = array(
    'Posts' => array('index'),
    'Add new',
);
?>
<div class="box">
    <header>
        <h5>Add new post</h5>
    </header>
    <div class="body">

	<fieldset>
	    <legend><span></span><h2 id="portfolioHeading">Select parent category</h2></legend>
	    <select class="input-admin select-box select-in-admin" id="select-parent-cat">
		<?php foreach ($aParentCats as $parentCat) { ?>
    		<option value="<?php echo $parentCat['category_id'] ?>" 
		    <?php if ($icat == $parentCat['category_id']) echo "selected" ?>
    			><?php echo $parentCat['name'] ?></option>
			<?php } ?>
	    </select>
	</fieldset>


	<?php
	//form for post wish, talent, food, fashion
	if ($icat != 3) {
	    ?>
	    <?php
	    $form = $this->beginWidget('CActiveForm', array(
		'htmlOptions' => array(
		    'class' => 'form-horizontal',
		    'enctype' => "multipart/form-data"
	    )));
	    ?>
	    <?php if ($form->errorSummary($modelPost)) { ?>
		<div class='alert alert-danger'>
		    <?php echo $form->errorSummary($modelPost); ?>
		</div>
	    <?php } ?>
	    <?php if ($success) { ?>
		<div class='alert alert-success'>
		    You have posted successfully.
		</div>
	    <?php } ?>
    	<fieldset>

    	    <legend><span></span><h2 id="portfolioHeading">Add your post Details</h2></legend>

    	    <div class="control-group">				
    		<label for="inputEmail" class="control-label">Title <span>*</span></label>
    		<div class="controls">
			<?php echo $form->textField($modelPost, 'title'); ?>
    		</div>
    	    </div>

    	    <div class="control-group">
    		<label class="control-label">Content <span>*</span></label>
    		<div class="controls">
			<?php echo $form->textArea($modelPost, 'content'); ?>
    		</div>
    	    </div>

    	    <div class="control-group">
    		<label class="control-label">Photo</label>
    		<div class="controls">
    		    <input type='file' accept='image/*' name='photo'/>
    		</div>
    	    </div>

    	    <div class="control-group">
    		<label class="control-label">Share link:</label>
    		<div class="controls">
    		    <input type='text' name='sharelink' placeholder="Copy and paste share link from" style="width: 208px"/>
    		    <select name='typeEmbedded'>    				        				    
    			<option value='youtube' <?php if (isset($_POST['typeEmbedded']) && $_POST['typeEmbedded'] == 'youtube') echo "selected"; ?>>Youtube</option>
    			<option value='vimeo' <?php if (isset($_POST['typeEmbedded']) && $_POST['typeEmbedded'] == 'vimeo') echo "selected"; ?>>Vimeo</option>
    		    </select>
    		</div>
    	    </div>

    	    <div class="control-group">

    		<label class="control-label">Publicize, or keep it private</label>

    		<div class="controls">
			<?php echo $form->radioButtonList($modelPost, 'is_private', array('0' => 'Public Page', '1' => 'Private Page')); ?>
    		</div>
    	    </div>

    	    <div class="control-group">
    		<label class="control-label">Categories</label>
    		<div class="controls">
			<?php echo $form->dropDownList($modelPost, 'category_id', $aData, array('class' => "select-in-admin")); ?>
    		</div>
    	    </div>

    	</fieldset>    		    
    	<div class="control-group">
    	    <div class="controls">    				
    		<input type="submit" class="btn btn-large btn-info post-blog" value="Post" name='submit'/>
    	    </div>
    	</div>

	    <?php
	    $this->endWidget();
	    ?>
	    <?php
	}
	else {

	    $form = $this->beginWidget('CActiveForm', array(
		'htmlOptions' => array(
		    'class' => 'form-horizontal',
		    'enctype' => "multipart/form-data"
	    )));
	    ?>
	    <?php if ($form->errorSummary($modelPost) || $error) { ?>
		<div class='alert alert-danger'>
		    <?php echo $form->errorSummary($modelPost); ?>
		    <?php echo $error; ?>
		</div>
	    <?php } ?>

	    <?php if ($success) { ?>
		<div class='alert alert-success'>
		    You have posted successfully.
		</div>
	    <?php } ?>
    	<fieldset>
    	    <legend><span></span><h2 id="portfolioHeading">Add your Event Details</h2></legend>

    	    <div class="control-group">
    		<label for="inputEmail" class="control-label">Your Event Title <span>*</span></label>
    		<div class="controls">
			<?php echo $form->textField($modelPost, 'title'); ?>
    		</div>
    	    </div>

    	    <div class="control-group">
    		<label for="inputEmail" class="control-label">Venue Name</label>
    		<div class="controls">
			<?php echo $form->textField($modelPost, 'venue_name_event'); ?>
    		</div>
    	    </div>
    	    <div class="control-group">
    		<label for="inputEmail" class="control-label">Street Address</label>
    		<div class="controls">
			<?php echo $form->textField($modelPost, 'street_address_event'); ?>
    		</div>
    	    </div>

    	    <div class="control-group">
    		<label for="inputPassword" class="control-label">Date & Time <span>*</span></label>
    		<div class="controls">

    		    <div id="datetimepicker4" class="input-append">
    			<input data-format="yyyy-MM-dd" type="text" placeholder="Date" style="width:75px;" name='date_start_event' value="<?php if (isset($_POST['date_start_event'])) echo $_POST['date_start_event']; ?>"/>
    			<span class="add-on">
    			    <i data-time-icon="icon-time" data-date-icon="icon-calendar">
    			    </i>
    			</span>
    		    </div>
    		    <div id="datetimepicker3" class="input-append">
    			<input data-format="hh:mm:ss" type="text" placeholder="Time" style="width:60px;" name='time_start_event' value="<?php if (isset($_POST['time_start_event'])) echo $_POST['time_start_event']; ?>"/>
    			<span class="add-on">
    			    <i data-time-icon="icon-time" data-date-icon="icon-calendar">
    			    </i>
    			</span>
    		    </div>
    		    - 

    		    <div id="datetimepicker5" class="input-append">
    			<input data-format="yyyy-MM-dd" type="text" placeholder="Date" style="width:75px;" name='date_end_event' value="<?php if (isset($_POST['date_end_event'])) echo $_POST['date_end_event']; ?>">
    			<span class="add-on">
    			    <i data-time-icon="icon-time" data-date-icon="icon-calendar">
    			    </i>
    			</span>
    		    </div>
    		    <div id="datetimepicker6" class="input-append">
    			<input data-format="hh:mm:ss" type="text" placeholder="Time" style="width:60px;" name='time_end_event'value="<?php if (isset($_POST['time_end_event'])) echo $_POST['time_end_event']; ?>">
    			<span class="add-on">
    			    <i data-time-icon="icon-time" data-date-icon="icon-calendar">
    			    </i>
    			</span>
    		    </div>  
    		</div>
    	    </div>
    	    <div class="control-group">
    		<label class="control-label">Photo</label>
    		<div class="controls">
    		    <input type='file' accept='image/*' name='photo'/>
    		</div>
    	    </div>

    	    <div class="control-group">
    		<label class="control-label">Share link:</label>
    		<div class="controls">
    		    <input type='text' name='sharelink' placeholder="Copy and paste share link from" style="width: 208px"/>
    		    <select name='typeEmbedded'>    				        				    
    			<option value='youtube' <?php if (isset($_POST['typeEmbedded']) && $_POST['typeEmbedded'] == 'youtube') echo "selected"; ?>>Youtube</option>
    			<option value='vimeo' <?php if (isset($_POST['typeEmbedded']) && $_POST['typeEmbedded'] == 'vimeo') echo "selected"; ?>>Vimeo</option>
    		    </select>
    		</div>
    	    </div>

    	    <div class="control-group">				
    		<label for="inputEmail" class="control-label">Content <span>*</span></label>
    		<div class="controls">
			<?php echo $form->textArea($modelPost, 'content'); ?>
    		</div>
    	    </div>
    	    <div class="control-group">
    		<label for="inputEmail" class="control-label">Organizer Name</label>
    		<div class="controls">
			<?php echo $form->textField($modelPost, 'organizer_name'); ?>
    		</div>
    	    </div>
    	    <div class="control-group">
    		<label for="inputEmail" class="control-label">Organizer Description</label>
    		<div class="controls">
			<?php echo $form->textArea($modelPost, 'organizer_description_event'); ?>
    		</div>
    	    </div>


    	</fieldset>

    	<fieldset>
    	    <legend><span></span><h2 id="portfolioHeading">Promote your Event Page</h2></legend>
    	    <div class="control-group">
    		<label for="inputEmail" class="control-label">Publicize, or keep it private</label>
    		<div class="controls">
			<?php echo $form->radioButtonList($modelPost, 'is_private', array('0' => 'Public Page', '1' => 'Private Page')); ?>
    		</div>
    	    </div>
    	    <div class="control-group">
    		<label for="inputEmail" class="control-label">Categories</label>
    		<div class="controls">
			<?php echo $form->dropDownList($modelPost, 'category_id', $aData, array('class' => "select-in-admin")); ?>
    		</div>
    	    </div>

    	    <div class="control-group">
    		<label for="inputEmail" class="control-label">Customize Web Address</label>
    		<div class="controls">
			<?php echo $form->textField($modelPost, 'web_addr'); ?>
    		    <!--
    		    <input type="text"  style="width:200px">.zoupload.com
    		    -->
    		</div>
    	    </div>
    	</fieldset>
    	<div class="control-group">
    	    <div class="controls">
    		<input type="submit" class="btn btn-large btn-info post-blog" value="Post" name='submit'/>    			    
    	    </div>
    	</div>

	    <?php $this->endWidget(); ?>
	    <?php
	}
	?>
    </div>
</div>
